const guestbookModel = require('../../model/guestbookModel');

const guestbookService = {
    getList: async(skip,limit,userID) => {
        const data = await guestbookModel.find({userID}).sort({
            createTime: -1
        }).skip(skip).limit(limit);
        const total = await guestbookModel.countDocuments({userID});
        return {
            data,
            total
        }
    },
    delete: async(id) => {
        await guestbookModel.findByIdAndDelete(id);
    }
}

module.exports = guestbookService;